home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / os2 / be.zip / be.ini < prev    next >
Text File  |  1996-09-25  |  22KB  |  879 lines

  1. //
  2. // Binary Editor configuration file
  3. //
  4. // This default initialisation file has definitions to aid in the decoding
  5. // and display of bitmap headers, palettes and data of various formats.
  6. // This file may be extended to allow decoding of other file formats too.
  7. // It is admitted that the field names used to describe the various fields
  8. // may or may not match up that given in the official documentation.
  9. // 
  10.  
  11. unsigned dec
  12.  
  13. // OS/2 and Windows Bitmap File Format
  14. // Decode the headers and palettes, but not the bitmap bits
  15.  
  16. le
  17.  
  18. map BFT_ // bitmap file type
  19.     {
  20.     "BFT_ICON"         0x4349 // 'IC'
  21.     "BFT_BMAP"         0x4d42 // 'BM'
  22.     "BFT_POINTER"      0x5450 // 'PT'
  23.     "BFT_COLORICON"    0x4943 // 'CI'
  24.     "BFT_COLORPOINTER" 0x5043 // 'CP'
  25.     "BFT_BITMAPARRAY"  0x4142 // 'BA'
  26.     }
  27.  
  28. map BCA_ // ulCompression
  29.     {
  30.     "BCA_UNCOMP"    0
  31.     "BCA_RLE8"      1
  32.     "BCA_RLE4"      2
  33.     "BCA_HUFFMAN1D" 3
  34.     "BCA_RLE24"     4
  35.     }
  36.  
  37. map BRU_ // units
  38.     {
  39.     "BRU_METRIC" 0
  40.     }
  41.  
  42. map BRA_ // algorithm
  43.     {
  44.     "BRA_BOTTOMUP" 0
  45.     }
  46.  
  47. map BRH_ // halftoning alg
  48.     {
  49.     "BRH_NOTHALFTONED"   0
  50.     "BRH_ERRORDIFFUSION" 1
  51.     "BRH_PANDA"          2
  52.     "BRH_SUPERCIRCLE"    3
  53.     }
  54.  
  55. def RGB
  56.     {
  57.     n8 hex "bBlue "
  58.     n8 hex "bGreen"
  59.     n8 hex "bRed  "
  60.     }
  61.  
  62. def RGB2
  63.     {
  64.     n8 hex "bBlue    "
  65.     n8 hex "bGreen   "
  66.     n8 hex "bRed     "
  67.     n8 hex "fcOptions"
  68.     }
  69.  
  70. def BMP_PALETTE_11
  71.     {
  72.     0x100 RGB "argbColor"
  73.     }
  74.  
  75. def BMP_INFO_HEADER_11
  76.     {
  77.     n32 ptr BMP_PALETTE_11 "cbFix    "
  78.     n16                    "cx       "
  79.     n16                    "cy       "
  80.     n16                    "cPlanes  "
  81.     n16                    "cBitCount"
  82.     }
  83.  
  84. def BMP_PALETTE_20
  85.     {
  86.     0x100 RGB2 "argbColor"
  87.     }
  88.  
  89. def BMP_INFO_HEADER_20
  90.     {
  91.     n32 ptr BMP_PALETTE_20 rel "cbFix          "
  92.     n32                        "cx             "
  93.     n32                        "cy             "
  94.     n16                        "cPlanes        "
  95.     n16                        "cBitCount      "
  96.     n32 map BCA_               "ulCompression  "
  97.     n32                        "cbImage        "
  98.     n32                        "cxResolution   "
  99.     n32                        "cyResolution   "
  100.     n32                        "cclrUsed       "
  101.     n32                        "cclrImportant  "
  102.     n16 map BRU_               "usUnits        "
  103.     n16                        "usReserved     "
  104.     n16 map BRA_               "usRecording    "
  105.     n16 map BRH_               "usRendering    "
  106.     n32                        "cSize1         "
  107.     n32                        "cSize2         "
  108.     n32                        "ulColorEncoding"
  109.     n32 hex                    "ulIdentifier   "
  110.     }
  111.  
  112. def BMP_INFO_HEADER
  113.     {
  114.     n32                     "cbFix       "
  115.     at 0 BMP_INFO_HEADER_11 "if cbFix==12"
  116.     at 0 BMP_INFO_HEADER_20 "if cbFix>12 "
  117.     }
  118.  
  119. def BMP_FILE_HEADER
  120.     {
  121.     n16 map BFT_    "usType  "
  122.     n32             "cbSize  "
  123.     n16 signed      "xHotspot"
  124.     n16 signed      "yHotspot"
  125.     n32 hex         "offBits "
  126.     BMP_INFO_HEADER "bmp     "
  127.     }
  128.  
  129. def BMP_ARRAY_FILE_HEADER
  130.     {
  131.     n16 map BFT_                      "usType   "
  132.     n32                               "cbSize   "
  133.     n32 hex ptr BMP_ARRAY_FILE_HEADER "offNext  "
  134.     n16                               "cxDisplay"
  135.     n16                               "cyDisplay"
  136.     BMP_FILE_HEADER                   "bfh      "
  137.     }
  138.  
  139. def BMP_FILE
  140.     {
  141.     n16 map BFT_               "usType                    "
  142.     at 0 BMP_FILE_HEADER       "if usType==BFT_BMAP       "
  143.     at 0 BMP_ARRAY_FILE_HEADER "if usType==BFT_BITMAPARRAY"
  144.     }
  145.  
  146. // Targa files
  147. // Decode the header
  148.  
  149. le
  150.  
  151. map TGA_
  152.     {
  153.     "TGA_NO_IMAGE"    0
  154.     "TGA_UNCOMP_CM"   1
  155.     "TGA_UNCOMP_RGB"  2
  156.     "TGA_UNCOMP_BW"   3
  157.     "TGA_RL_CM"       9
  158.     "TGA_RL_RGB"     10
  159.     "TGA_RL_BW"      11
  160.     "TGA_COMP_CM"    32
  161.     "TGA_COMP_CM_4"  33
  162.     }
  163.  
  164. map IDB_
  165.     {
  166.     "IDB_ORIGIN"  0x20 : 0x20
  167.     "IDB_NON_INT" 0x00 : 0xc0
  168.     "IDB_2_WAY"   0x40 : 0xc0
  169.     "IDB_4_WAY"   0x80 : 0xc0
  170.     }
  171.  
  172. def TGA_HEADER
  173.     {
  174.     n8          "n_chars_in_id       "
  175.     n8          "color_map_present   "
  176.     n8 map TGA_ "image_type          "
  177.     n16         "color_map_start     "
  178.     n16         "color_map_length    "
  179.     n8          "color_map_entry_bits"
  180.     n16         "x_origin            "
  181.     n16         "y_origin            "
  182.     n16         "width               "
  183.     n16         "height              "
  184.     n8          "bpp                 "
  185.     n8 map IDB_ "image_descriptor    "
  186.     }
  187.  
  188. def TGA_FILE
  189.     {
  190.     n8 ptr TGA_HEADER null "n_chars_in_id"
  191.     buf 255 asc            "id           "
  192.     }
  193.  
  194. // KIPS files
  195. // Decode the header
  196.  
  197. def KPS_FILE
  198.     {
  199.     buf 8 asc  "signiture (=DFIMAG00)"
  200.     n16        "height               "
  201.     n16        "width                "
  202.     buf 20 hex "unknown              "
  203.     }
  204.  
  205. // PCX file
  206. // Decode header with small inline 4bpp palette
  207. // Don't decode compressed bitmap bits or trailer with 8bpp palette
  208.  
  209. map PCXENC_
  210.     {
  211.     "PCXENC_RLE" 1
  212.     }
  213.  
  214. def PCX_RGB
  215.     {
  216.     n8 hex "red  "
  217.     n8 hex "green"
  218.     n8 hex "blue "
  219.     }
  220.  
  221. def PCX_FILE
  222.     {
  223.     n8 hex         "magic# (=0x0a)      "
  224.     n8             "version (=0,1,2,3,5)"
  225.     n8 map PCXENC_ "compression         "
  226.     n8             "bpppp               "
  227.     n16            "x1                  "
  228.     n16            "y1                  "
  229.     n16            "x2                  "
  230.     n16            "y2                  "
  231.  
  232.     at 16
  233.     16 PCX_RGB     "4bpp palette        "
  234.  
  235.     at 65
  236.     n8             "planes              "
  237.     n16            "bytes_per_line      "
  238.     n8             "colour/bw           "
  239.  
  240.     at 0
  241.     8 buf 16 hex   "header as hex       "
  242.     }
  243.  
  244. // M-Motion VID file
  245.  
  246. le
  247.  
  248. def VID_FILE
  249.     {
  250.     buf 6 asc "signiture (=YUV12C)"
  251.     buf 2 hex "padding            "
  252.     n16       "xpos               "
  253.     n16       "ypos               "
  254.     n16       "xsize              "
  255.     n16       "ysize              "
  256.     }
  257.  
  258. // TIFF file
  259.  
  260. $ifdef BE_TIFF
  261. be
  262. $else
  263. le
  264. $endif
  265.  
  266. map TIFF_T
  267.     {
  268.     "T_NEWSUBFILETYPE"        254
  269.     "T_SUBFILETYPE"           255
  270.     "T_IMAGEWIDTH"            256
  271.     "T_IMAGELENGTH"           257
  272.     "T_BITSPERSAMPLE"         258
  273.     "T_COMPRESSION"           259
  274.     "T_PHOTOMETRIC"           262
  275.     "T_THRESHOLDING"          263
  276.     "T_CELLWIDTH"             264
  277.     "T_CELLLENGTH"            265
  278.     "T_FILLORDER"             266
  279.     "T_DOCNAME"               269
  280.     "T_DESCRIPTION"           270
  281.     "T_MAKE"                  271
  282.     "T_MODEL"                 272
  283.     "T_STRIPOFFSETS"          273
  284.     "T_ORIENTATION"           274
  285.     "T_SAMPLESPERPIXEL"       277
  286.     "T_ROWSPERSTRIP"          278
  287.     "T_STRIPBYTECOUNTS"       279
  288.     "T_MINSAMPLEVALUE"        280
  289.     "T_MAXSAMPLEVALUE"        281
  290.     "T_XRESOLUTION"           282
  291.     "T_YRESOLUTION"           283
  292.     "T_PLANARCONFIG"          284
  293.     "T_PAGENAME"              285
  294.     "T_XPOSITION"             286
  295.     "T_YPOSITION"             287
  296.     "T_FREEOFFSETS"           288
  297.     "T_FREEBYTECOUNTS"        289
  298.     "T_GRAYRESPONSEUNIT"      290
  299.     "T_GRAYRESPONSECURVE"     291
  300.     "T_GROUP3OPTIONS"         292
  301.     "T_GROUP4OPTIONS"         293
  302.     "T_RESOLUTIONUNIT"        296
  303.     "T_PAGENUMBER"            297
  304.     "T_COLORRESPONSECURVES"   301
  305.     "T_SOFTWARE"              305
  306.     "T_DATETIME"              306
  307.     "T_ARTIST"                315
  308.     "T_HOSTCOMPUTER"          316
  309.     "T_PREDICTOR"             317
  310.     "T_WHITEPOINT"            318
  311.     "T_PRIMARYCHROMA"         319
  312.     "T_COLORMAP"              320
  313.     "T_HALFTONEHINTS"         321
  314.     "T_TILEWIDTH"             322
  315.     "T_TILELENGTH"            323
  316.     "T_TILEOFFSETS"           324
  317.     "T_TILEBYTECOUNTS"        325
  318.     "T_INKSET"                332
  319.     "T_INKNAMES"              333
  320.     "T_NUMBEROFINKS"          334
  321.     "T_DOTRANGE"              336
  322.     "T_TARGETPRINTER"         337
  323.     "T_EXTRASAMPLES"          338
  324.     "T_SAMPLEFORMAT"          339
  325.     "T_SMINSAMPLEVALUE"       340
  326.     "T_SMAXSAMPLEVALUE"       341
  327.     "T_TRANSFERRANGE"         342
  328.     "T_JPEGPROC"              512
  329.     "T_JPEGINTERCHANGEFMT"    513
  330.     "T_JPEGINTERCHANGEFMTLEN" 514
  331.     "T_JPEGRESTARTINTERVAL"   515
  332.     "T_JPEGLOSSLESSPRED"      517
  333.     "T_JPEGPOINTTRANSFORMS"   518
  334.     "T_JPEGOTABLES"           519
  335.     "T_JPEGDCTABLES"          520
  336.     "T_JPEGACTABLES"          521
  337.     "T_COEFFICIENTS"          529
  338.     "T_SUBSAMPLING"           530
  339.     "T_REFERENCEBLACKWHITE"   532
  340.     }
  341.  
  342. map TIFF_D
  343.     {
  344.     "D_BYTE"       1
  345.     "D_ASCII"      2
  346.     "D_SHORT"      3
  347.     "D_LONG"       4
  348.     "D_RATIONAL"   5
  349.     "D_SBYTE"      6
  350.     "D_UNDEFINED"  7
  351.     "D_SSHORT"     8
  352.     "D_SLONG"      9
  353.     "D_SRATIONAL" 10
  354.     "D_FLOAT"     11
  355.     "D_DOUBLE"    12
  356.     }
  357.  
  358. def TIFF_RATIONAL
  359.     {
  360.     n32 unsigned "numerator  "
  361.     n32 unsigned "denominator"
  362.     }
  363.  
  364. def TIFF_SRATIONAL
  365.     {
  366.     n32 signed "numerator  "
  367.     n32 signed "denominator"
  368.     }
  369.  
  370. def TIFF_TAG_NI
  371.     {
  372.     at 0 buf 100 asc                  "data (if D_ASCII)    "
  373.     at 0 100 n8 unsigned open         "data (if D_BYTE)     "
  374.     at 0 100 n8 signed open           "data (if D_SBYTE)    "
  375.     at 0 100 n16 unsigned open        "data (if D_SHORT)    "
  376.     at 0 100 n16 signed open          "data (if D_SSHORT)   "
  377.     at 0 100 n32 unsigned open        "data (if D_LONG)     "
  378.     at 0 100 n32 signed open          "data (if D_SLONG)    "
  379.     at 0 100 TIFF_RATIONAL open open  "data (if D_RATIONAL) "
  380.     at 0 100 TIFF_SRATIONAL open open "data (if D_SRATIONAL)"
  381.     at 0 100 buf 4 hex open           "data (if D_FLOAT)    "
  382.     at 0 100 buf 8 hex open           "data (if D_DOUBLE)   "
  383.     at 0 16 buf 16 hex                "data                 "
  384.     }
  385.  
  386. def TIFF_TAG
  387.     {
  388.     n16 map TIFF_T               "type                "
  389.     n16 map TIFF_D               "data_type           "
  390.     n32                          "length              "
  391.     buf 4 asc                    "data (if D_ASCII)   "
  392.     at 8 4 n8 unsigned open      "data (if D_BYTE     "
  393.     at 8 4 n8 signed open        "data (if D_SBYTE)   "
  394.     at 8 2 n16 unsigned open     "data (if D_SHORT)   "
  395.     at 8 2 n16 signed open       "data (if D_SSHORT)  "
  396.     at 8 n32 unsigned            "data (if D_LONG)    "
  397.     at 8 n32 signed              "data (if D_SLONG)   "
  398.     at 8 buf 4 hex               "data (if D_FLOAT)   "
  399.     at 8 n32 hex ptr TIFF_TAG_NI "data (if non-inline)"
  400.     }
  401.  
  402. def TIFF_NEXT_IFD
  403.     {
  404.     n32 ptr TIFF_IFD "offset_ifd"
  405.     at 12
  406.     }
  407.  
  408. def TIFF_IFD
  409.     {
  410.     n16 ptr TIFF_NEXT_IFD mul add 2 rel "n_tags"
  411.     100 TIFF_TAG                        "tags  "
  412.     }
  413.  
  414. def TIFF_FILE
  415.     {
  416.     buf 2 asc        "byte_order (=II,MM) "
  417.     n16              "version_number (=42)"
  418.     n32 ptr TIFF_IFD "offset_ifd          "
  419.     }
  420.  
  421. // ILBM files
  422. // Decode chunk structure
  423.  
  424. be
  425.  
  426. map ILBM_COMP_TYPE
  427.     {
  428.     "none" 0
  429.     "rle"  1
  430.     }
  431.  
  432. map ILBM_MASKING
  433.     {
  434.     "none"        0
  435.     "mask"        1
  436.     "transparent" 2
  437.     }
  438.  
  439. def ILBM_BMHD_DATA
  440.     {
  441.     n16                   "width       "
  442.     n16                   "height      "
  443.     n16                   "xpos        "
  444.     n16                   "ypos        "
  445.     n8                    "bitsperpixel"
  446.     n8 map ILBM_MASKING   "masking     "
  447.     n8 map ILBM_COMP_TYPE "compression "
  448.     n8 hex                "unused      "
  449.     n16                   "transcol    "
  450.     n8                    "xaspect     "
  451.     n8                    "yaspect     "
  452.     n16                   "xscreen     "
  453.     n16                   "yscreen     "
  454.     }
  455.  
  456. map ILBM_CAMG_VALUE
  457.     {
  458.     "lace"    0x00000004 : 0x00000004
  459.     "ehb"    0x00000080 : 0x00000080
  460.     "ham"    0x00000800 : 0x00000800
  461.     "hires"    0x00008000 : 0x00008000
  462.     }
  463.  
  464. def ILBM_RGB
  465.     {
  466.     n8 hex "red  "
  467.     n8 hex "green"
  468.     n8 hex "blue "
  469.     }
  470.  
  471. def ILBM_SHAM_PAL
  472.     {
  473.     16 ILBM_RGB "0rgb's"
  474.     }
  475.  
  476. def ILBM_SHAM_DATA
  477.     {
  478.     n16               "sham version (=0)"
  479.     200 ILBM_SHAM_PAL "sham palettes    "
  480.     }
  481.  
  482. // note that chunk next pointer may require size rounding up by one
  483. // note size decoded first for ease of navigation
  484.  
  485. def ILBM_CHUNK
  486.     {
  487.     at 4 n32 ptr ILBM_CHUNK add 4 rel "size            "
  488.     at 4 n32 ptr ILBM_CHUNK add 5 rel "size (misalign) "
  489.     at 0 buf 4 asc                    "name            "
  490.     at 8 ILBM_BMHD_DATA               "data (if BMHD)  "
  491.     at 8 n32 map ILBM_CAMG_VALUE      "data (if CAMG)  "
  492.     at 8 0x100 ILBM_RGB               "data (if CMAP)  "
  493.     at 8 ILBM_SHAM_DATA               "data (if SHAM)  "
  494.     at 8 buf 100 hex                  "data (otherwise)"
  495.     }
  496.  
  497. def ILBM_FILE
  498.     {
  499.     buf 4 asc  "form       "
  500.     n32        "length     "
  501.     buf 4 asc  "ilbm       "
  502.     ILBM_CHUNK "first chunk"
  503.     }
  504.  
  505. // GIF file
  506. // Decode headers and block structures
  507.  
  508. le
  509.  
  510. map GIF_GCT_BPP
  511.     {
  512.     "gct"    0x80 : 0x80
  513.     "no_gct" 0x00 : 0x80
  514.     }
  515.  
  516. def GIF_RGB
  517.     {
  518.     n8 hex "red  "
  519.     n8 hex "green"
  520.     n8 hex "blue "
  521.     }
  522.  
  523. def GIF_CHUNK
  524.     {
  525.     n8 ptr GIF_CHUNK add 1 rel           "size               "
  526.     16 buf 16 hex                        "data               "
  527.     at 0 n8 ptr GIF_BLOCK add 1 rel null "follow if size is 0"
  528.     }
  529.  
  530. def GIF_EXTENSION
  531.     {
  532.     n8 hex    "introducer (=0x21)   "
  533.     n8 hex    "graphic control label"
  534.     GIF_CHUNK "first chunk          "
  535.     }
  536.  
  537. map GIF_LCT_BPP
  538.     {
  539.     "lct"           0x80 : 0x80
  540.     "no_lct"        0x00 : 0x80
  541.     "ilace"         0x40 : 0x40
  542.     "no_ilace"      0x00 : 0x40
  543. //    "sortedpalette" 0x?? : 0x??
  544.     }
  545.  
  546. def GIF_IMAGE_DESC
  547.     {
  548.     n8 hex                             "introducer (=0x2c)     "
  549.     n16                                "xpos                   "
  550.     n16                                "ypos                   "
  551.     n16                                "width                  "
  552.     n16                                "height                 "
  553.     n8 map GIF_LCT_BPP                 "lct bpp-1              "
  554.     n8                                 "min_LZW_code_size-1    "
  555.     at 11                    GIF_CHUNK "1st chunk if (no   lct)"
  556.     at 11+  2*sizeof GIF_RGB GIF_CHUNK "1st chunk if (1bpp lct)"
  557.     at 11+  4*sizeof GIF_RGB GIF_CHUNK "1st chunk if (2bpp lct)"
  558.     at 11+  8*sizeof GIF_RGB GIF_CHUNK "1st chunk if (3bpp lct)"
  559.     at 11+ 16*sizeof GIF_RGB GIF_CHUNK "1st chunk if (4bpp lct)"
  560.     at 11+ 32*sizeof GIF_RGB GIF_CHUNK "1st chunk if (5bpp lct)"
  561.     at 11+ 64*sizeof GIF_RGB GIF_CHUNK "1st chunk if (6bpp lct)"
  562.     at 11+128*sizeof GIF_RGB GIF_CHUNK "1st chunk if (7bpp lct)"
  563.     at 11+256*sizeof GIF_RGB GIF_CHUNK "1st chunk if (8bpp lct)"
  564.     }
  565.  
  566. def GIF_TERM
  567.     {
  568.     n8 hex "introducer (=0x3b)"
  569.     }
  570.  
  571. def GIF_BLOCK
  572.     {
  573.     n8 hex              "introducer"
  574.     at 0 GIF_EXTENSION  "if 0x21   "
  575.     at 0 GIF_IMAGE_DESC "if 0x2c   "
  576.     at 0 GIF_TERM       "if 0x3b   "
  577.     }
  578.  
  579. // signature and screen descriptor
  580.  
  581. def GIF_FILE
  582.     {
  583.     buf 6 asc                          "signiture (GIFxxx)     "
  584.     n16                                "xscreen                "
  585.     n16                                "yscreen                "
  586.     n8 map GIF_GCT_BPP                 "gct bpp-1              "
  587.     n8                                 "bg index               "
  588.     n8 hex                             "?                      "
  589.     0x100 GIF_RGB                      "gct (if got one)       "
  590.     at 13                    GIF_BLOCK "1st block if (no   gct)"
  591.     at 13+  2*sizeof GIF_RGB GIF_BLOCK "1st block if (1bpp gct)"
  592.     at 13+  4*sizeof GIF_RGB GIF_BLOCK "1st block if (2bpp gct)"
  593.     at 13+  8*sizeof GIF_RGB GIF_BLOCK "1st block if (3bpp gct)"
  594.     at 13+ 16*sizeof GIF_RGB GIF_BLOCK "1st block if (4bpp gct)"
  595.     at 13+ 32*sizeof GIF_RGB GIF_BLOCK "1st block if (5bpp gct)"
  596.     at 13+ 64*sizeof GIF_RGB GIF_BLOCK "1st block if (6bpp gct)"
  597.     at 13+128*sizeof GIF_RGB GIF_BLOCK "1st block if (7bpp gct)"
  598.     at 13+256*sizeof GIF_RGB GIF_BLOCK "1st block if (8bpp gct)"
  599.     }
  600.  
  601. // RiscOS Sprites
  602. // Display headers and data (rather crudely)
  603.  
  604. le
  605.  
  606. map SPRITE_MODE
  607.     {
  608.     "640x256x1bpp"                    0
  609.     "320x256x2bpp"                    1
  610.     "160x256x4bpp"                    2
  611.     "Text only"                    3
  612.     "320x256x1bpp"                    4
  613.     "160x256x2bpp"                    5
  614.     "160x256x2bpp"                    6
  615.     "Teletext"                    7
  616.     "640x256x2bpp"                    8
  617.     "320x256x4bpp"                    9
  618.     "160x256x8bpp"                    10
  619.     "640x250x2bpp"                    11
  620.     "640x256x4bpp"                    12
  621.     "320x256x8bpp"                    13
  622.     "640x250x4bpp"                    14
  623.     "640x256x8bpp"                    15
  624.     "1056x250x4bpp"                    16
  625.     "1056x256x4bpp"                    17
  626.     "640x512x1bpp multisync-monitor"        18
  627.     "640x512x2bpp multisync-monitor"        19
  628.     "640x512x4bpp multisync-monitor"        20
  629.     "640x512x8bpp multisync-monitor"        21
  630.     "1152x896x1bpp 61.2Hz-hires-monitor"        23
  631.     "1056x256x8bpp"                    24
  632.     "640x480x1bpp multisync-or-60Hz-VGA-monitor"    25
  633.     "640x480x2bpp multisync-or-60Hz-VGA-monitor"    26
  634.     "640x480x4bpp multisync-or-60Hz-VGA-monitor"    27
  635.     "640x480x8bpp multisync-or-60Hz-VGA-monitor"    28
  636.     }
  637.  
  638. // 2 RGB values match if not flashing
  639.  
  640. def SPRITE_PAL
  641.     {
  642.     n8 hex "?    "
  643.     n8 hex "red  "
  644.     n8 hex "green"
  645.     n8 hex "blue "
  646.     n8 hex "?    "
  647.     n8 hex "red  "
  648.     n8 hex "green"
  649.     n8 hex "blue "
  650.     }
  651.  
  652. // List the first few bytes of data
  653. // Give it laid out at several widths
  654. // Remember, nibbles can be swapped
  655.  
  656. def SPRITE_DATA
  657.     {
  658.     at 0 50 buf  4 hex "data (1 dword  per line)"
  659.     at 0 50 buf  8 hex "data (2 dwords per line)"
  660.     at 0 50 buf 12 hex "data (3 dwords per line)"
  661.     at 0 50 buf 16 hex "data (4 dwords per line)"
  662.     at 0 50 buf 20 hex "data (5 dwords per line)"
  663.     at 0 50 buf 24 hex "data (6 dwords per line)"
  664.     at 0 50 buf 28 hex "data (7 dwords per line)"
  665.     at 0 50 buf 32 hex "data (8 dwords per line)"
  666.     }
  667.  
  668. def SPRITE_HDR
  669.     {
  670.     n32 hex ptr SPRITE_HDR rel          "next_sprite      "
  671.     buf 12 asc                          "name             "
  672.     n32                                 "width_in_dwords-1"
  673.     n32                                 "scan_lines-1     "
  674.     n32                                 "first_bit        "
  675.     n32                                 "last_bit         "
  676.     n32 hex ptr SPRITE_DATA add -32 rel "offset_image     "
  677.     n32 hex ptr SPRITE_DATA add -36 rel "offset_mask      "
  678.     n32 map SPRITE_MODE                 "mode             "
  679.     0x40 SPRITE_PAL                     "palette          "
  680.     }
  681.  
  682. def SPRITE_FILE
  683.     {
  684.     n32                           "num_sprites "
  685.     n32 hex ptr SPRITE_HDR add -4 "first_sprite"
  686.     }
  687.  
  688. // PSEG files
  689. // I don't know very much about the internal structure of these.
  690. // Here is enough to allow loading and saving of 1bpp PSEG files.
  691.  
  692. be
  693.  
  694. def PSEG_COMMENT
  695.     {
  696.     buf 100 ebc "text"
  697.     }
  698.  
  699. def PSEG_BEGIN_PAGE
  700.     {
  701.     buf 100 ebc "segment (often is filename)"
  702.     }
  703.  
  704. def PSEG_BEGIN_IMG_BLOCK
  705.     {
  706.     buf 100 ebc "image (often is filename)"
  707.     }
  708.  
  709. map PSEG_ORIENTATION
  710.     {
  711.     "90degrees" 0x2d
  712.     }
  713.  
  714. def PSEG_IMG_OUTPUT_CTL
  715.     {
  716.     buf 6 hex               "?          "
  717.     buf 2 hex               "?          "
  718.     n8 map PSEG_ORIENTATION "orientation"
  719.     buf 1 hex               "?          "
  720.     buf 8 hex               "?          "
  721.     n16                     "x_scale    "
  722.     n16                     "y_scale    "
  723.     buf 2 hex               "reserved   "
  724.     }
  725.  
  726. def PSEG_INPUT_IMG_DESC
  727.     {
  728.     buf 2                   "?             "
  729.     n16 hex                 "0 or 0x0960   "
  730.     n16 hex                 "0 or 0x0960   "
  731.     buf 8 hex               "?             "
  732.     n16 hex                 "0 or 0x0960   "
  733.     n16 hex                 "0 or 0x0960   "
  734.     n16                     "bytes_per_line"
  735.     n16                     "lines         "
  736.     buf 4 hex               "?             "
  737.         n8 map PSEG_ORIENTATION "orientation   "
  738.     buf 1 hex               "?             "
  739.     n16                     "x_cell        "
  740.     n16                     "y_cell        "
  741.     buf 4 hex               "? (=00001ffff)"
  742.     }
  743.  
  744. def PSEG_RASTER_DATA
  745.     {
  746.     buf 100 hex "data"
  747.     }
  748.  
  749. def PSEG_IMG_CELL_POSN
  750.     {
  751.     n16 "x_cell_pos "
  752.     n16 "y_cell_pos "
  753.     n16 "x_cell_size"
  754.     n16 "y_cell_size"
  755.     n16 "x_fill_size"
  756.     n16 "y_fill_size"
  757.     }
  758.  
  759. def PSEG_END_IMG_BLOCK
  760.     {
  761.     buf 100 ebc "image (often is filename)"
  762.     }
  763.  
  764. def PSEG_END_PAGE
  765.     {
  766.     buf 100 ebc "segment (often is filename)"
  767.     }
  768.  
  769. def PSEG_RECORD
  770.     {
  771.     n8  hex                   "start (=0x5a)   "
  772.     n16 ptr PSEG_RECORD rel   "data_size       "
  773.     buf 3 hex                 "type            "
  774.     buf 3 hex                 "?               "
  775.     at 9 PSEG_COMMENT         "if type==@deeeee"
  776.     at 9 PSEG_BEGIN_PAGE      "if type==@d3a85f"
  777.     at 9 PSEG_BEGIN_IMG_BLOCK "if type==@d3a87b"
  778.     at 9 PSEG_IMG_OUTPUT_CTL  "if type==@d3a77b"
  779.     at 9 PSEG_INPUT_IMG_DESC  "if type==@d3a67b"
  780.     at 9 PSEG_RASTER_DATA     "if type==@d3ee7b"
  781.     at 9 PSEG_IMG_CELL_POSN   "if type==@d3ac7b"
  782.     at 9 PSEG_END_IMG_BLOCK   "if type==@d3a97b"
  783.     at 9 PSEG_END_PAGE        "if type==@d3a95f"
  784.     at 9 buf 100 hex          "as raw data     "
  785.     }
  786.  
  787. def PSEG_FILE
  788.     {
  789.     PSEG_RECORD "first_record"
  790.     }
  791.  
  792. // 3D Texture block file, as understood by Andys CSG Raytracer,
  793. // and the Modular Renderer C++ class library, written by the BE author.
  794.  
  795. le
  796.  
  797. def TEX_FILE
  798.     {
  799.     n32 hex     "magic  "
  800.     n32 dec     "w      "
  801.     n32 dec     "h      "
  802.     n32 dec     "d      "
  803.     n32 dec     "bpv    "
  804.     buf 100 hex "data..."
  805.     }
  806.  
  807. // OS/2 Resource File
  808. // Assume types and names are not ASCII strings.
  809.  
  810. le
  811.  
  812. map RES_TYPE
  813.     {
  814.     "RT_POINTER"       1
  815.     "RT_BITMAP"        2
  816.     "RT_MENU"          3
  817.     "RT_DIALOG"        4
  818.     "RT_STRING"        5
  819.     "RT_FONTDIR"       6
  820.     "RT_FONT"          7
  821.     "RT_ACCELTABLE"    8
  822.     "RT_RCDATA"        9
  823.     "RT_DLGINCLUDE"   11
  824.     "RT_FKALONG"      17
  825.     "RT_HELPTABLE"    18
  826.     "RT_HELPSUBTABLE" 19
  827.     }
  828.  
  829. map RES_MEM_FLAGS
  830.     {
  831.     "NSCODE"    0x0000 : 0x0007
  832.     "NSDATA"    0x0001 : 0x0007
  833.     "NSITER"    0x0008 : 0x0008
  834.     "NSMOVE"    0x0010 : 0x0010
  835.     "NSPURE"    0x0020 : 0x0020
  836.     "NSPRELOAD" 0x0040 : 0x0040
  837.     "NSEXRD"    0x0080 : 0x0080
  838.     "NSRELOC"   0x0100 : 0x0100
  839.     "NSCONFORM" 0x0200 : 0x0200
  840.     "NSDPL0"    0x0400 : 0x0400
  841.     "NSDPL1"    0x0800 : 0x0800
  842.     "NSDISCARD" 0x1000 : 0x1000
  843.     "NS32BIT"   0x2000 : 0x2000
  844.     "NSHUGE"    0x4000 : 0x4000
  845.     }
  846.  
  847. // fields reordered so that link to next is first
  848.  
  849. def RES_FILE
  850.     {
  851.     at 8 n32 ptr RES_FILE add 4 rel "data_size        "
  852.     at 0 n8 hex                     "(=0xff)          "
  853.     n16 map RES_TYPE                "resource_type    "
  854.     n8 hex                          "(=0xff)          "
  855.     n16                             "name             "
  856.     n16 map RES_MEM_FLAGS           "memory_flags     "
  857.     at 12 buf 100 hex               "data...          "
  858.     at 12 BMP_FILE                  "data if RT_BITMAP"
  859.     }
  860.  
  861. // Choose what to decode. Simply overlay all the different filetypes given in
  862. // this configuration file on top of each other.
  863.  
  864. def main union
  865.     {
  866.     BMP_FILE    "Bitmap file"
  867.     TGA_FILE    "Targa  file"
  868.     KPS_FILE    "KIPS   file"
  869.     PCX_FILE    "PCX    file"
  870.     VID_FILE    "VID    file"
  871.     TIFF_FILE   "TIFF   file"
  872.     ILBM_FILE   "ILBM   file"
  873.     GIF_FILE    "GIF    file"
  874.     SPRITE_FILE "Sprite file"
  875.     PSEG_FILE   "PSEG   file"
  876.     TEX_FILE    "TEX    file"
  877.     RES_FILE    "RES    file"
  878.     }
  879.